package LeetCode.month02.day36;

public class No58 {
    public int lengthOfLastWord(String s) {
        s = s.trim();
        int n = s.length();
        int res = 0;
        char[] c = s.toCharArray();
        for (int i = c.length - 1; i >= 0; i--) {
            if(c[i]==' ') break;
            res++;
        }
        return res;
    }
}
